home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.EOFException;
- import java.io.IOException;
- import symjava.sql.SQLException;
- import symjava.sql.SQLWarning;
-
- public class Warning extends ServerObject {
- String _message = new String("");
- String _SQLState = new String("");
- int _code = 0;
-
- Warning() {
- }
-
- public SQLWarning toSQLWarning() {
- return new SQLWarning(this._message, this._SQLState, this._code);
- }
-
- int getType() {
- return 88;
- }
-
- void read(DataInputStream in) throws SQLException, IOException, ErrorException {
- in.readShort();
- byte[] leader = new byte[4];
- in.readFully(leader, 0, 4);
- ServerObject obj = (ServerObject)NetClass.getNextObject(in);
- if (obj.getType() == 52) {
- this._message = ((NetString)obj).toString();
- } else {
- ((ServerObject)this).onObjectError(obj);
- }
-
- obj = (ServerObject)NetClass.getNextObject(in);
- if (obj.getType() == 52) {
- this._SQLState = ((NetString)obj).toString();
- } else {
- ((ServerObject)this).onObjectError(obj);
- }
-
- obj = (ServerObject)NetClass.getNextObject(in);
- if (obj.getType() == 51) {
- try {
- this._code = ((NetData)obj).getInt();
- } catch (EOFException e) {
- throw new SQLException(((Throwable)e).getMessage());
- }
- } else {
- ((ServerObject)this).onObjectError(obj);
- }
-
- obj = (ServerObject)NetClass.getNextObject(in);
- if (obj.getType() != 50) {
- ((ServerObject)this).onObjectError(obj);
- }
-
- }
-
- void write(DataOutputStream out) throws IOException {
- out.writeByte(this.getType());
- out.writeShort(0);
- NetString s = new NetString(this._message);
- s.write(out);
- s = new NetString(this._SQLState);
- s.write(out);
- NetData d = new NetData(this._code);
- d.write(out);
- EOT eot = new EOT();
- eot.write(out);
- }
- }
-